<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>

  <template id="my-app">
    <h2>{{getFullName()}}</h2>
    <h2>{{getFullName()}}</h2>
    <h2>{{getFullName()}}</h2>

    <h1>{{fullName}}</h1>
    <h1>{{fullName}}</h1>
    <h1>{{fullName}}</h1>


  </template>


  <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.3.4/vue.global.js"></script>
  <script>
    Vue.createApp({
      template: '#my-app',
      data() {
        return {
          firstName: 'Tom',
          lastName: 'John'
        }
      },
      computed: { // 计算属性是响应式执行的
        fullName () {
          console.log('computed中的：', this.firstName + ' ' + this.lastName);
          return this.firstName + ' ' + this.lastName
        }
      },
      methods: {
        getFullName() {
          console.log('methods中的：', this.firstName + this.lastName);
          return this.firstName + this.lastName
        }
      }
    }).mount('#app')
  </script>
</body>
</html>